postgresql+pgadmin3安装
检查5432端口是否被占用,如果占用则释放
1.运行postgresql-9.3.1.xxx.run
安装好postgresql和pgadmin III
2.创建数据库目录和日志目录
[root@NOK postgresql-9.3.1]# mkdir /usr/local/pgsql/data (mkdir创建目录)
[root@NOK postgresql-9.3.1]# mkdir /usr/local/pgsql/log
[root@NOK postgresql-9.3.1]# touch /usr/local/pgsql/log/pgsql.log (touch创建空文件)
改变属主:
[root@NOK postgresql-9.3.1]# chown -R postgres:postgres /usr/local/pgsql/data
[root@NOK postgresql-9.3.1]# chown -R postgres:postgres /usr/local/pgsql/log
[root@NOK postgresql-9.3.1]# chown -R postgres:postgres /usr/local/pgsql/log/pgsql.log
3.初始化数据库并建立数据库和用户
[root@NOK postgresql-9.3.1]# su postgres 如果指令无法执行,则在指令前加绝对路径/usr/local/pgsql/bin/
bash-4.1$ initdb -D /usr/local/pgsql/data
bash-4.1$ pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/log/pgsql.log start
4.命令查看服务是否已经启动:
bash-4.1$ ps -A | grep postgres
5.创建数据库
bash-4.1$ createdb BUS
bash-4.1$ exit
6.配置监听地址和端口:
vi /usr/local/pgsql/data/postgresql.conf
取消以下两行的注释
listen_addresses = '*'
port = 5432
7.允许远程连接:
[root@NOK postgresql-9.3.1]# vi /usr/local/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 0.0.0.0/0 trust
# IPv6 local connections:
host all all ::1/128 trust
8.修改防火墙配置文件:
[root@NOK postgresql-9.3.1]# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
9.[root@NOK postgresql-9.3.1]# service iptables restart
10.设置随机启动
vi /etc/profile
把下面的放到文件的最后
export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/pgsql/bin:$PATH
export PGDATA=/usr/local/pgsql/data
export MANPATH=$MANPATH:/usr/local/pgsql/man
退出执行source /etc/profile
11.chkconfig postgresql-9.3 on //开机启动
12.service postgresql-9.3 restart //重启postgresql
rpm 安装指令 rpm -ivh xxx.rpm
rpm -Uvh xxx.rpm
rpm -ivh --aid xxx.rpm
rpm 卸载指令 rpm -e xxx